<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <Style x:Key="CustomDialogStyle" TargetType="controls:ChildWindow">
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="TabNavigation" Value="Cycle"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="OverlayOpacity" Value="0.5"/>
        <!--<Setter Property="OverlayBrush" Value="#FFE9EBEF"/>-->
        <Setter Property="Foreground" Value="#FF1561A7" />
        <Setter Property="FontFamily" Value="Arial" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ChildWindow">
                    <Grid x:Name="Root">
                        <!-- Centraliza a pagina -->
                        <Grid x:Name="Overlay" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" 
                              Opacity="{TemplateBinding OverlayOpacity}" Background="{TemplateBinding OverlayBrush}"/>

                        <Grid x:Name="ContentRoot" 
                              Width="{TemplateBinding Width}"
                              Height="{TemplateBinding Height}" 
                              HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                              >

                            <Border BorderThickness="0">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>

                                    <!-- Barra de Titulo-->
                                    <Border x:Name="Chrome" Width="Auto">
                                        <Grid Height="Auto" Width="Auto">
                                            <!--<Border Height="23" BorderThickness="1" Background="#FF5A7194" CornerRadius="8,8,0,0" BorderBrush="#FF484848" VerticalAlignment="Top" />-->
                                            <Border Height="28" BorderThickness="1,1,1,0" Background="WhiteSmoke" CornerRadius="8,8,0,0" BorderBrush="#FF484848" VerticalAlignment="Top" />

                                            <ContentControl Content="{TemplateBinding Title}"
                                                            FontSize="18" 
                                                            Foreground="{TemplateBinding Foreground}"
                                                            HorizontalAlignment="Stretch" VerticalAlignment="Top" 
                                                            FontWeight="Bold" FontFamily="Arial"
                                                            Margin="20,5,6,0" IsTabStop="{TemplateBinding IsTabStop}" />
                                        </Grid>
                                    </Border>
                                    
                                    <!-- Conteudo -->
                                    <Border x:Name="Content" Grid.Row="1" Background="{TemplateBinding Background}">
                                        <Grid Margin="0,0,0,0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition/>
                                            </Grid.RowDefinitions>
                                            
                                            <Border BorderThickness="1,0,1,1" Background="#FFFFFFFF" CornerRadius="0,0,12,12" BorderBrush="#FF484848" 
                                                    Margin="0,0,0,0" Grid.RowSpan="2" />
                                            
                                            <ContentPresenter x:Name="ContentPresenter" 
                                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                                              Content="{TemplateBinding Content}" 
                                                              ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                              Margin="5" />

                                        </Grid>
                                    </Border>

                                    
                                </Grid>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="TextReadOnly" TargetType="TextBox">
        <Setter Property="Background" Value="White" />
        <!--<Setter Property="BorderThickness" Value="0" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <vsm:VisualStateManager.VisualStateGroups>

                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="ReadOnly"/>
                                </vsm:VisualStateGroup.Transitions>

                                <vsm:VisualState x:Name="Normal"/>

                                <vsm:VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ReadOnlyVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                        </vsm:VisualStateManager.VisualStateGroups>

                        <Border x:Name="Border" Opacity="1" CornerRadius="1"
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" >
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement" Opacity="0" Background="#FFFFFFFF"/>
                                <Border x:Name="MouseOverElement" BorderThickness="0">
                                    <ScrollViewer BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}" x:Name="ContentElement"/>
                                </Border>
                            </Grid>
                        </Border>

                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
